home *** CD-ROM | disk | FTP | other *** search
- %OP%VS4.13 (28-Apr-92), Gerald L Fitton, R4000 5966 9904 9938
- %OP%DP0
- %OP%IRY
- %OP%PL0
- %OP%HM0
- %OP%FM0
- %OP%BM0
- %OP%LM4
- %OP%PT1
- %OP%PDPipeLine
- %OP%WC2,1286,176,1748,0,0,0,0
- %CO:A,72,72%
- %C%Using the Index and Set_value Functions
- %C%by Gerald L Fitton
- Keywords:
- Index Set_value Push Fitton
-
-
- Introduction
-
- I have been asked to write an article giving explanations of more of
- the "Index functions". This is the second of what I expect to be a
- short series of articles in which I shall describe how the "Index
- functions" and "Array functions" may be used. In the first article, in
- the directory [Index02] (on an earlier disc), I explained how to 'pull'
- a single value from an array. In this article I explain how, together
- with set_value(,) you can 'push' a value into a single slot within an
- array.
-
- What you might not know is that you can vary the receiving slot (into
- which you 'push' a value), specifying the slot with two numbers which
- may themselves be the result of a calculation! This process is similar
- to 'indirect addressing' - for those of you who know what that means.
-
-
- set_value(index(array,col,row),value)
-
- First a quick reminder. In PipeDream 4 the index(array,col,row)
- function works differently from PipeDream 3.
-
- The way in which most people use the 'basic' index function is to use
- it to 'pull' a single value from an array. This was demonstrated in
- the article in Array02 - I suggest that you read that before this one.
-
- In this article I shall demonstrate how to 'push' a value into an
- array. Load the file [Index] from this directory and have a look at
- the formula in slot [Index]B33. It is the only slot in that
- spreadsheet which contains a formula rather than a value; this formula
- is used to 'push' the value "The_Value" into the slot identified by
- index(Array,Col_No,Row_No).
-
- The formula reads: set_value(index(Array,Col_No,Row_No),The_Value)
-
- The words "Array", "Col_No", "Row_No" and "The_Value" in this formula
- are all PipeDream Names. Place the pointer on the italic f of [Index]
- (just to the right of the PipeDream 4 logo near the top of the [Index]
- file) and click the mouse select (left) button once. At the bottom of
- the pop-up menu you'll find Edit name. Run the pointer through Edit
- name and then through Array. You'll see that Array has been defined as
- the block [Index]C4H9. To make identification easier I have used a
- consistent pattern for the data held in this array generated by the
- formula 1000*column plus the row - for example the value 4008 appears
- in the fourth column, D, and the eighth row of the [Index] file.
-
-
- Other Names
-
- You will find that the contents of slots B16, B17 and B18 are named.
-
- You can enter values into B16 and B17 (or, like one of our
- correspondents, you can enter a formula which returns a number). I
- have entered 1 into B16 and 2 into B17. I have given these slots
- PipeDream Names. The method of naming a slot is to click on the italic
- f and run the pointer through Define name in the pop-up menu. Enter
- the Name in the top dialogue box alongside "Name:" and enter the slot
- to which it refers (in our case B16 or B17) in the dialogue box
- alongside "Refers to:". Have a look at the Edit name dialogue if you
- have doubts.
-
- The PipeDream Names I have used are Row_no and Col_No.
-
- In the same way I have named the contents of slot B18 as The_Value.
-
-
- Using the 'Push' facility
-
- Change the value in slot B18 and you will see the new value appear in
- the first column, second row of the array. When Col_No = 1 and
- Row_No = 2 the number in B18 (The Value) will be pushed into slot C5.
-
- If you change the contents of either B16 or B17 then The Value will be
- 'Pushed' into a different part of the Array.
-
- The values in B16 and B17 can be calculated values or they themselves
- can be the result of a 'Push' operation, maybe from another document!
-
-
- The 'Input Document'
-
- Double click on the file [InputDoc] to load it.
-
- Change the values in slots [InputDoc]B10B12.
-
- You will find that the appropriate value in [Index03]Array changes.
-
- These changes are 'pushed' into [Index03] through the formula in
- [InputDoc]C15. This formula is the only formula in [InputDoc] and it
- uses the Name "In" which is defined in [InputDoc].
-
-
- The 'Output Document'
-
- Double click on the file [Output] to load it.
-
- You will see that the Array (from [Index]) appears in the block A4F9.
-
- If you change the [InputDoc] then the [Output] will change!
-
- These changes are 'pulled' into [Output] by the formula in [Output]A4.
- This formula uses the Name "Out" which is defined in [Output].
-
-
- For Later
-
- I have been asked to describe how array operations such as addition and
- multiplication can be used to simplify operations on large blocks of
- numbers in a spreadsheet. This I shall do on later discs. However,
- if, in the meantime you have an 'array' problem then please don't
- hesitate to write to me. If you do then it will help me if you will
- send a disc containing a file of suitable data and some notes in a
- [ReadMe] file saying what it is that you want to do. Sending me files
- on disc you will help me to be sure that I understand exactly what it
- is you are trying to do; furthermore, it will save me the time it takes
- to construct a file of dummy data (which might not be representative of
- your requirements).
-